Using button layers

Button layer is an object you can use to create interactions with 2D content through clicking.

Button layer does not have a visual shape, so you have to attach to it another layer, such as an image layer or a text layer, to give the button layer a shape. When a user clicks the layer attached to a button layer, the action generates a message that travels to the button layer where you can define the behavior for that message.

The Click message is available by default, but you can add other messages as well. For example, you can add messages that are triggered when a user presses down a mouse button or cancels a click.

Creating a button layer

To create a button layer:

  1. In the Project right-click the layer where you want to create a button layer and select Create > Button Layer.
  2. In the Project add a layer to the button layer.
    For example, add a Text Layer.
  3. In the Project select the button layer and in the Properties in the Click message click the Add drop-down menu and select one of the triggers.
    For example, select Write Log and set its Log Message property to <Name>. In the Preview when you click the text layer you added to the button layer, this trigger writes the name of the text layer to the Log window.

See also

Using toggle button layers

Using buttons

Using toggle buttons